<html>
<head><meta charset="utf-8"><title>x.py dependence on ~/.cargo/config · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html">x.py dependence on ~/.cargo/config</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="223490312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223490312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nemo157 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223490312">(Jan 21 2021 at 10:23)</a>:</h4>
<p>I have finally gotten back to hacking on some rustdoc stuff, but <code>./x.py test rustdoc</code> is failing to build <code>rustc-main</code>:</p>
<div class="codehilite"><pre><span></span><code>   Compiling rustc-main v0.0.0 (/home/nemo157/sources/rust/compiler/rustc)
error: cannot prefer dynamic linking when performing LTO
note: only &#39;staticlib&#39;, &#39;bin&#39;, and &#39;cdylib&#39; outputs are supported with LTO
error: aborting due to previous error
error: could not compile `rustc-main`

command did not execute successfully: &quot;/home/nemo157/sources/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo&quot; &quot;build&quot; &quot;--target&quot; &quot;x86_64-unknown-linux-gnu&quot;
 &quot;-Zbinary-dep-depinfo&quot; &quot;-j&quot; &quot;20&quot; &quot;--release&quot; &quot;--features&quot; &quot; llvm&quot; &quot;--manifest-path&quot; &quot;/home/nemo157/sources/rust/compiler/rustc/Cargo.toml&quot; &quot;--message-format&quot; &quot;
json-render-diagnostics&quot;
expected success, got: exit code: 101
failed to run: /home/nemo157/sources/rust/build/bootstrap/debug/bootstrap test rustdoc
Build completed unsuccessfully in 0:05:19
</code></pre></div>
<p>I assume this is because I have globally enabled LTO in <code>~/.cargo/config</code>:</p>
<div class="codehilite" data-code-language="TOML"><pre><span></span><code><span class="k">[profile.release]</span>
<span class="n">lto</span> <span class="o">=</span> <span class="kc">true</span>
</code></pre></div>
<p>Should the bootstrap be force disabling LTO somehow so that the build is independent of global config? Or do I need to add my own local <code>.cargo/config</code> override for this?</p>



<a name="223490498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223490498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nemo157 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223490498">(Jan 21 2021 at 10:25)</a>:</h4>
<p>well, actually looks like the second option doesn't work, I put a local <code>.cargo/config</code> inside my rust checkout disabling LTO again, and <code>./x.py test rustdoc</code> deleted it <span aria-label="sweat" class="emoji emoji-1f613" role="img" title="sweat">:sweat:</span></p>



<a name="223490825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223490825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nemo157 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223490825">(Jan 21 2021 at 10:29)</a>:</h4>
<p>Yep, bootstrap doesn't want you configuring cargo &lt;<a href="https://github.com/rust-lang/rust/blob/master/src/bootstrap/bootstrap.py#L997">https://github.com/rust-lang/rust/blob/master/src/bootstrap/bootstrap.py#L997</a>&gt;</p>



<a name="223491497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223491497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nemo157 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223491497">(Jan 21 2021 at 10:36)</a>:</h4>
<div class="codehilite"><pre><span></span><code>CARGO_PROFILE_RELEASE_LTO=false x.py test rustdoc
</code></pre></div>
<p>works, and I could add this to my <code>.envrc</code>, but it'd be nice if x.py took care of it</p>



<a name="223530589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223530589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223530589">(Jan 21 2021 at 16:11)</a>:</h4>
<p><span class="user-mention" data-user-id="210267">@Nemo157</span> the problem IMO is you could be setting arbitrary cargo options, which can mess with bootstrapping in arbitrary ways. I don't think a targeted fix at LTO is particularly useful, I'd rather find a way to ignore .cargo/config altogether.</p>



<a name="223530936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223530936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nemo157 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223530936">(Jan 21 2021 at 16:14)</a>:</h4>
<p>Yep, I definitely agree with that; especially if it is user-visible like <code>cargo --no-config</code> because I have to hack around it with things like <code>HOME=$(mktemp -d) cargo</code> already to have config-independent tools</p>



<a name="223531287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223531287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223531287">(Jan 21 2021 at 16:16)</a>:</h4>
<p>If it's as easy as passing --no-config to cargo that definitely seems like the right approach</p>



<a name="223531326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223531326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223531326">(Jan 21 2021 at 16:16)</a>:</h4>
<p>You'd add it to <code>fn cargo</code> in <a href="http://builder.rs">builder.rs</a></p>



<a name="223531782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223531782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nemo157 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223531782">(Jan 21 2021 at 16:19)</a>:</h4>
<p>well, it's not right now cause <code>cargo</code> has no flag for that <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<a name="223531855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223531855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nemo157 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223531855">(Jan 21 2021 at 16:20)</a>:</h4>
<p>but maybe this is a good enough usecase to finally add it?</p>



<a name="223532170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223532170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223532170">(Jan 21 2021 at 16:22)</a>:</h4>
<p>Hmm, I wonder how much setting CARGO_HOME would mess things up</p>



<a name="223532171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223532171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223532171">(Jan 21 2021 at 16:22)</a>:</h4>
<p>(deleted)</p>



<a name="223532172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223532172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223532172">(Jan 21 2021 at 16:22)</a>:</h4>
<p>That would avoid reading ~/.config, right?</p>



<a name="223532435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223532435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nemo157 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223532435">(Jan 21 2021 at 16:23)</a>:</h4>
<p>I think it's only <code>HOME</code> that controls it, not <code>CARGO_HOME</code>, and it does work cause that's the sort of hack I do in other tools</p>



<a name="223532672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223532672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nemo157 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223532672">(Jan 21 2021 at 16:23)</a>:</h4>
<p>but x.py is _somewhat_ independent of ~/.cargo/config already, it ignores the custom <code>rustflags</code> I have set in there</p>



<a name="223532812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223532812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nemo157 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223532812">(Jan 21 2021 at 16:24)</a>:</h4>
<p>maybe that's just a side-effect of other stuff it's doing, not on purpose</p>



<a name="223533703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20dependence%20on%20%7E/.cargo/config/near/223533703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nemo157 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20dependence.20on.20~.2F.2Ecargo.2Fconfig.html#223533703">(Jan 21 2021 at 16:29)</a>:</h4>
<p>&lt;<a href="https://github.com/rust-lang/cargo/pull/7894#issuecomment-685077878">https://github.com/rust-lang/cargo/pull/7894#issuecomment-685077878</a>&gt; is probably the most relevant recent comment around having it supported by <code>cargo</code> properly, asking for an RFC for it</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>